{% extends "forum/base.html" %}
{% load static %}

{% block describe %}
<!-- 主页描述 -->
<div class="content" id="loadingDiv">

  <!-- Page header -->
  <div class="page-header">
              
    <p><h3>{{ stock_name }} ({{ stock_code }})</h3></p>
  {% if followed %}
  <a href="{% url 'forum:unfollow_stock' stock_name %}" class="btn btn-success text-right" role="button">取消关注</a>
  {% else %}
  <a href="{% url 'forum:follow_stock' stock_name %}" class="btn btn-success text-right" role="button">关注</a>
  {% endif %}
  {% if messages %}
        {% for msg in messages %}
        <script>
                alert('{{ msg.message }}');
        </script>
        {% endfor %}
  {% endif %}
  <a href="{% url 'forum:stock_est' stock_code %}"><button class="btn btn-success text-right" onclick="changeToLoading()">股票预测</button></a>
  </div>
  <!-- /Page header -->

  <!-- Page container -->
  <div class="page-container">

    <div>
      <h3>实时价格：&nbsp;&nbsp;{{ current_price }}&nbsp;
        {% if if_rise == 1 %}
        <font color="red"><span class="icon-arrow-up"></span> {{ change }} , +{{ pct_chg }}%</font>
        {% else %}
        <font color="green"><span class="icon-arrow-down"></span> {{ change }} , {{ pct_chg }}%</font>
        {% endif %}
      </h3>
      <br>
    </div>
    <div>
      <!-- 默认内容：今日行情 -->
      <h3>近期行情</h3>
      <!-- 默认自动加载展示的内容 样式最后统一改 -->
      <iframe src="{% static "klines/temp_custom.html" %}" name="" width="900" height="450" id=""></iframe>
    </div>
    <div>
      <iframe name="htmlContent" class="bodyHtml" src="{% url 'forum:custom_kline' stock_name %}" width="900" height="450"></iframe>
    </div>
              
  </div>
  <!-- /Page container -->
</div>
<!-- /主页描述 -->
<script>
  function changeToLoading(){
    var obj=document.getElementById('loadingDiv');
    obj.innerHTML="<br><br><br><br><br><br><br><br><br><br><br><br><div style='text-align: center;'><p>正在预测中，这可能需要20s~1min的时间</p><img src={% static 'images/preloader.gif' %} /></div><br><br><br><br><br><br><br><br><br><br><br>";
  }
</script>
{% endblock describe %}
